<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>


      var arr=[1,2,3,45,2,1,5,1,8,45]


const arr1 = [1, 2, 3];
const arr2 = [3, 4, 5];
// 去重1
console.log(new Set([...arr1, ...arr2]));
// 去重2
       var newarr=[]
        arr.forEach(item=>{
              if(newarr.indexOf(item)==-1){
                    newarr.push(item)
              }
        })
       console.log(newarr,'???');
    </script>
</body>
</html>